<template>
  <el-form :inline="true" :model="inquires" class="demo-form-inline">
    <el-form-item label="查询值">
      <el-input v-model="inquires.searValue" placeholder="查询值"></el-input>
    </el-form-item>
    <el-form-item label="条件">
      <el-select v-model="inquires.searType" placeholder="条件">
        <el-option label="全部" value="all"></el-option>
        <el-option label="名称" value="commodityName"></el-option>
        <el-option label="价格" value="price"></el-option>
        <el-option label="产地" value="orgin"></el-option>
        <el-option label="包装" value="package"></el-option>
        <el-option label="库存量" value="inventoryNumbers"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">查询</el-button>
    </el-form-item>
  </el-form>
</template>
<script>
import axios from "axios";
import { createNamespacedHelpers } from "vuex";
var { mapState, mapActions } = createNamespacedHelpers("merchant");
export default {
  data() {
    return {
      inquires: {
        searType: "all",
        searValue: ""
      }
    };
  },
  methods: {
    ...mapActions(["getInventoryListAsync", "quireInventoryAsync"]),
    onSubmit() {
      if (this.inquires.searType == "all") {
        this.inquires.searValue = "";
        this.getInventoryListAsync();
      } else {
        this.quireInventoryAsync(this.inquires);
      }
    }
  }
};
</script>
<style scoped>
.el-table th,
.el-table td {
  text-align: center !important;
}
.el-main {
  line-height: normal !important;
}
.el-button--primary{
  background-color: #f3a83f;
  border: 1px solid #f3a83f;
}
</style>